﻿using Net.Msg;
using Net.Public.Client;
using Net.Public.EventSystem;
using Net.Public.Helper;
using Net.Public.Msg;
using UnityEngine;


namespace HotUpdate
{
    /// <summary>
    /// 热更新程序集入口
    /// 通信使用事件进行分发
    /// </summary>
    public class GameLaunch : MonoBehaviour
    {
        private float RES_GC_TIME = 10;
        private GameMgr _gameMgr;
        private RpcClient _client;
        private void Start()
        {
            _gameMgr = new GameMgr();
            _gameMgr.Start(gameObject);
            _client = new RpcClient();
            _client.OnStart(GameMgr.Timer, "127.0.0.1", 8088);
            RpcEventSystem.Instance.RegisterMsg(EMsgType.TestMsg, (msg) =>
            {
                TestMsg testMsg = (TestMsg)msg;
                Debugger.Log("收到服务器消息:" + testMsg.Content);
            });
        }

        private void Update()
        {
            _gameMgr.Update();
        }
    }
}